<div class="sidebox">				
				<h1>Recherche de logements</h1>	
			
					<p>Tapez le <strong>nom</strong> du logement:
					<input id="nomLogement" type="text" />
					<a href="#" id="log" ><img src="/images/search.gif"/></a>
					<span class="suggestName">...par exemple: <span class="nameLog">rosa</span></span>	
  					</p>		
			</div>

<script type="text/javascript">


       jQuery(function () {
			$("#nomLogement").autocomplete("/home/searchAutocompleteVivienda", {
				minChars: 2,
				max: 12,
				autoFill: false,
				mustMatch: true,
				matchContains: true,
				scroll: false,
				width: 159,
				formatItem: function(row, i, max) {
					$data = row[0];
					$arrData = $data.split("*");
					return $arrData[2] + " " + $arrData[3] + " (" + $arrData[4] + "p.)";
				},
				
				formatResult: function(row, i, max) {
					$data = row[0];
					$arrData = $data.split("*");
					return $arrData[2] + " " + $arrData[3];
				},
				
				formatMatch: function(row, i, max) {
					$data = row[0];
					$arrData = $data.split("*");
					return $arrData[3];
				},
			});   

		$("#nomLogement").result(function(event, data, formatted) {
				if(data != undefined){
					$arrData = data.toString().split("*");
					$("#log").attr("href", "/location/"+$arrData[0] + "-" + $arrData[1]);
				}
				
			});				
		});
		</script>	